package com.bao.work.work01;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

/**
 * @author baoye
 * @date 2024-08-01/19:43
 */
public class Test {
    public static void main(String[] args) {
        List<Book> books=new LinkedList<>();
        books.add(new Book("1","功夫熊猫",new BigDecimal("110.5"),"功夫熊猫出版社"));
        books.add(new Book("5","大战火星",new BigDecimal("500.5"),"大战火星出版社"));
        books.add(new Book("2","功夫火星",new BigDecimal("200.5"),"北京出版社"));
        books.add(new Book("3","大战熊猫",new BigDecimal("330.5"),"普普通通出版社"));
        books.add(new Book("4","功夫大战",new BigDecimal("540.5"),"磨磨蹭蹭出版社"));

        books.forEach(System.out::println);
        System.out.println("------------------------------------------------------------");

        Map<Book,String> booksMap=new HashMap<>();
        Book b1=new Book("1","功夫熊猫",new BigDecimal("110.5"),"功夫熊猫出版社");
        Book b2=new Book("5","大战火星",new BigDecimal("500.5"),"大战火星出版社");
        Book b3=new Book("2","功夫火星",new BigDecimal("200.5"),"北京出版社");
        Book b4=new Book("3","大战熊猫",new BigDecimal("330.5"),"普普通通出版社");
        Book b5=new Book("4","功夫大战",new BigDecimal("540.5"),"磨磨蹭蹭出版社");
        booksMap.put(b1,b1.getId());
        booksMap.put(b2,b2.getId());
        booksMap.put(b3,b3.getId());
        booksMap.put(b4,b4.getId());
        booksMap.put(b5,b5.getId());

        booksMap.forEach((key,value)-> System.out.println(key));
    }
}
